<?php
namespace app\Backend\controller;;
use think\Db;
use clt\Leftnav;
use app\Backend\model\Order as OrderModel;
use think\Validate;
class Order extends Common
{
    public function _initialize(){
        parent::_initialize();
    }
    public function index()
    {
        return $this->fetch();
    }

    // 新增订单
    public function orderAdd(){
        //1.新增订单 order表

        //2新增订单记录 order_status表
    }

    //订单列表
    public function orderList(){

        $list = db('user')->order('id desc')->select();
        $result = ['code'=>0,'msg'=>'获取成功!','data'=>$list,'rel'=>1];
        $this->assign('lists',$result['data']);
        return view();
    }

    //修改订单
    public function orderEdit(){
        $id             = input('id');
        $map['id']      = $id;
        $map['is_sys']  = 0;
        return $result = ['code'=>0,'msg'=>'订单修改失败!','url'=>''];
    }

    //取消订单--状态改为取消
    public function orderEditStatus(){
        $id             = input('id');
        $map['id']      = $id;
        $map['is_sys']  = 0;
        return $result = ['code'=>0,'msg'=>'订单取消失败!','url'=>''];
    }

    //删除订单
    public function orderDel(){
        $id             = input('id');
        $map['id']      = $id;
        if (db('order')->where($map)->delete()){
            return $result = ['code'=>1,'msg'=>'删除成功!','url'=>'/reload'];
        }else{
            return $result = ['code'=>0,'msg'=>'用户信息删除失败!','url'=>''];
        }
    }


}